<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button>前进</button>
  <button>后退</button>
  <button>刷新</button>
  <script>
    const btn1 = document.querySelector('button:nth-child(1)');
    const btn2 = document.querySelector('button:nth-child(2)');
    const btn3 = document.querySelector('button:nth-child(3)');
    const btn4 = document.querySelector('button:nth-child(4)');
    btn1.addEventListener('click', () => {
      // 前进一步
      history.forward();
      history.go(1);
    });
    btn2.addEventListener('click', () => {
      // 后退一步
      history.back();
      history.go(-1);
    });
    btn3.addEventListener('click', () => {
      // 刷新
      history.reload();
    });
  </script>
</body>
</html>